<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/10/21/0021
 * Time: 13:43
 */

namespace App\Transformers;


use App\Models\Jinpai;
use League\Fractal\TransformerAbstract;

class JinpaiTramsformer extends TransformerAbstract
{
    protected $availableIncludes = ['good','category'];
    public function transform(Jinpai $jinpai){
        return [
            'id' => $jinpai->id,
            'min_price' => $jinpai->min_price,
            'created_at' => $jinpai->created_at,
        ];
    }

    public function includeGood(Jinpai $jinpai){
        return $this->item($jinpai->good,new GoodslistTransformer());
    }

}